<template>
  <div>
    <!-- <i>我爱昝道广</i>
    <i>{{projectId}}</i>
    <i>{{status}}</i> -->
    <el-form :model="projectList" v-loading.body="listLoading" ref="projectList" label-width="100px">
      <el-form-item label="项目名称：">
        
        <i>{{projectList.projectName}}</i>
      </el-form-item>

      <el-form-item label="项目描述：">
        <i>{{projectList.projectDesc}}</i>
        
      </el-form-item>
      
      <el-form-item label="开始时间：">
        <i>{{projectList.startDate}}</i>
        
      </el-form-item>

      <el-form-item label="结束时间：">
        <i>{{projectList.endDate}}</i>
        
      </el-form-item>

      <el-form-item label="委员名称：">
        <i>{{projectList.committeeName}}</i>
        
      </el-form-item>
      <el-form-item label="委员成员：">
        
        
      </el-form-item>
      <el-table :data="committeeMember" border stripe>
          <el-table-column align="center" label="员工姓名" prop="member_name" style="width: 20px;"></el-table-column>
          <el-table-column align="center" label="所属组织" prop="member_org" style="width: 30px;"></el-table-column>
          <el-table-column align="center" label="证件号码" prop="certificate_id" style="width: 50px;"></el-table-column>
        </el-table>
        
<br>
<br>


      <el-form-item label="项目成员：">
        
        
      </el-form-item>
        <el-table :data="projectList.personList" border stripe>
          <el-table-column align="center" label="员工工号" prop="userId" style="width: 20px;"></el-table-column>
          <el-table-column align="center" label="姓名" prop="username" style="width: 30px;"></el-table-column>
          <el-table-column align="center" label="身份类型" prop="certificateId" style="width: 50px;"></el-table-column>
          <el-table-column align="center" label="证件号码" prop="certificateNumber" style="width: 60px;"></el-table-column>
        </el-table>

    </el-form>
    

  </div>
  
</template>
<script>
// author:zandaoguang
  import {mapGetters} from 'vuex'

  export default {
    data() {
      return {
        projectList:[],
        listLoading: false,//数据加载等待动画
        project:{
          projectId:'',
          status :''
        },
        committee:{
          committee_id: null,
          pageNum: 1, //页码
          pageRow: 10, //每页条数
          value: ""
        },
        committeeMember:[]
      }
    },
    created() {
      // if (this.hasPerm('project:add') || this.hasPerm('project:update')) {
      //   this.getProjectList();
      // }
      console.log('oppppppppppppppppppppppppppppppppp');
      if (this.hasPerm('project:add') || this.hasPerm('project:update')) {
        this.getProjectList();
      }

    },
    mounted() {
      
      // this.$destroy();
    },
    destroyed(){
      console.log('iuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu');
    },
    computed: {
      ...mapGetters([
        'projectId',
        'status',
      ]),
      
    },
    watch: {
      "projectId" : function(){
        console.log('rrrrrrrrrrrrrrrrrrrrrrrrrrrr');
        this.getProjectList();
      }
    },
    methods: {
      getProjectList(){
        //查询列表
        this.listLoading = true;
        // return;
        this.project.projectId =this.projectId;
        this.project.status = this.status;
        console.log("ppppp:",this.project);
        // return
        this.api({
          url: "/staff/getProjectListById",
          method: "post",
          data: this.project
        }).then(data => {
          // alert("xxxxxxxxxxxxxxxxx")
          // console.log('standard:');
          console.log("我是小数据啊：",data);
          console.log("我是小数据啊s：",data[0]);
          
          // console.log('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
          
          this.listLoading = false;
          this.projectList = data[0];

          // return;
          for(var i = 0 ; i < this.projectList.personList.length ; i++){
            console.log('tag:', this.projectList.personList[i].certificateId)
            if(this.projectList.personList[i].certificateId == 1){
              this.projectList.personList[i].certificateId = "居民身份证";
            }
            else if(this.projectList.personList[i].certificateId == 2){
              this.projectList.personList[i].certificateId = "出生证";
            }
            else if(this.projectList.personList[i].certificateId == 3){
              this.projectList.personList[i].certificateId = "护照";
            }
            else if(this.projectList.personList[i].certificateId == 4){
              this.projectList.personList[i].certificateId = "警官证";
            }
            else if(this.projectList.personList[i].certificateId == 5){
              this.projectList.personList[i].certificateId = "执行公务证";
            }
            else if(this.projectList.personList[i].certificateId == 6){
              this.projectList.personList[i].certificateId = "学生证";
            }
            else if(this.projectList.personList[i].certificateId == 7){
              this.projectList.personList[i].certificateId = "毕业证";
            }
            else if(this.projectList.personList[i].certificateId == 8){
              this.projectList.personList[i].certificateId = "签证";
            }
            else if(this.projectList.personList[i].certificateId == 9){
              this.projectList.personList[i].certificateId = "结婚证";
            }
            else if(this.projectList.personList[i].certificateId == 10){
              this.projectList.personList[i].certificateId = "离婚证";
            }
            else if(this.projectList.personList[i].certificateId == 11){
              this.projectList.personList[i].certificateId = "独生子女证";
            }
            else if(this.projectList.personList[i].certificateId == 12){
              this.projectList.personList[i].certificateId = "驾驶证";
            }else{
              this.projectList.personList[i].certificateId = "暂无此类型";
            }
          }
          console.log('committeeId:', this.projectList.committeeId);
          this.committee.committee_id = this.projectList.committeeId;
          console.log('committee:::', this.committee);
          // return;


          this.api({
            url: "/committeeMember/listCommitteeMemberByCommittee",
            method: "get",
            params: this.committee
          }).then(data => {
            console.log('xxxxxxxxxxxxxxxxx:', data);
            this.committeeMember = data.list;
            console.log('this.committeeMember', this.committeeMember);
          })
          console.log('ssss')
        })
        // alert("xxxxx");
        // window.setTimeout(this.example,3000);
        
        
      },


    }
  }
</script>
